/**
 * Created by cherry
 */

import api from '../../api/api';
import * as types from '../mutation';


const state = {
  order:{
    recommend:[],
    allList:[]

  }
};

const getters = {
    reList: state => state.order.recommend,
    allMenuList: state => state.order.allList


};

const actions = {
  getRecommendList({commit}){
      api.getRecommendList(function(res){
          commit(types.RECOMMEND_LIST_SUCCESS,{res});

      })
  },
  getAllMenuList({commit}){
      api.getAllMenuList(function(res){

          commit(types.ALL_MENU_LIST_SUCCESS,{res});
      });
 }
}

const mutations = {
    [types.RECOMMEND_LIST_SUCCESS](state,{res}){
        state.order.recommend=res;
    },
    [types.ALL_MENU_LIST_SUCCESS](state,{res}){

      state.order.allList=res;

    }
};


export default{
    state,
    getters,
    actions,
    mutations
}
